program my_hdf5
  use hdf5
  implicit none

  integer(HID_T) :: file_id, dataset_id, dataspace_id
  integer :: status
  integer(HSIZE_T) :: dims(2)  ! 使用 INTEGER(8) 类型的变量
  integer :: i
  integer, parameter :: nx = 10, ny = 10
  real :: data(nx, ny)

  ! Initialize data (for demonstration purposes)
  do i = 1, nx
    data(i, :) = real(i)
  end do

  ! Create HDF5 file
  call h5open_f(status)
  call h5fcreate_f("my_data.h5", H5F_ACC_TRUNC_F, file_id, status)

  ! Create dataspace
  dims = [nx, ny]  ! 使用 INTEGER(8) 类型的数组
  call h5screate_simple_f(2, dims, dataspace_id, status)

  ! Create dataset
  call h5dcreate_f(file_id, "my_dataset", H5T_NATIVE_REAL, dataspace_id, dataset_id, status)

  ! Write data to dataset
  ! call h5dwrite_f_f(dataset_id, H5T_NATIVE_REAL, data, status)

  ! Close resources
  call h5dclose_f(dataset_id, status)
  call h5sclose_f(dataspace_id, status)
  call h5fclose_f(file_id, status)
  call h5close_f(status)

end program my_hdf5
